/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * VerEventoBilheteria.java
 *
 * Created on 26/06/2012, 16:53:10
 */
package View;

import Controller.Controller;
import Model.Evento;

/**
 *
 * @author lcc
 */
public class VerEventoBilheteria extends javax.swing.JFrame {

    private Evento evento;
    private Controller controller;
    
    public VerEventoBilheteria() {
        initComponents();
    }

    public VerEventoBilheteria(Evento evento) {
        this.evento = evento;
        this.controller = Controller.getInstance();
        initComponents();
        this.evento = evento;
        controller = Controller.getInstance();
        titulo.setText(evento.getTituloShow());
        if (evento.getArtistas().isEmpty()) {
            labelArtistas.setVisible(false);
            artista1Nome.setVisible(false);
            artista1Gene.setVisible(false);
            artista2Nome.setVisible(false);
            artista2Gene.setVisible(false);
            artista3Nome.setVisible(false);
            artista3Gene.setVisible(false);
        } else if (evento.getArtistas().size() == 1) {
            artista1Nome.setText(evento.getArtistas().get(0).getNome());
            artista1Gene.setText(evento.getArtistas().get(0).getGenero());
            artista2Nome.setVisible(false);
            artista2Gene.setVisible(false);
            artista3Nome.setVisible(false);
            artista3Gene.setVisible(false);
        } else if (evento.getArtistas().size() == 2) {
            artista1Nome.setText(evento.getArtistas().get(0).getNome());
            artista1Gene.setText(evento.getArtistas().get(0).getGenero());
            artista2Nome.setText(evento.getArtistas().get(1).getNome());
            artista2Gene.setText(evento.getArtistas().get(1).getGenero());
            artista3Nome.setVisible(false);
            artista3Gene.setVisible(false);
        } else {
            artista1Nome.setText(evento.getArtistas().get(0).getNome());
            artista1Gene.setText(evento.getArtistas().get(0).getGenero());
            artista2Nome.setText(evento.getArtistas().get(1).getNome());
            artista2Gene.setText(evento.getArtistas().get(1).getGenero());
            artista3Nome.setText(evento.getArtistas().get(2).getNome());
            artista3Gene.setText(evento.getArtistas().get(2).getGenero());
        }
        cancelado.setVisible(evento.getCancelado());
        qtdTotalIngressos.setText(evento.getTextoIngressos());
        inicio.setText(evento.getInicioString());
        fim.setText(evento.getFimString());
        tipoAcomodacao.setText(evento.getTipoAcomodacao());
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        venderIngressoButton = new javax.swing.JButton();
        cancelado = new javax.swing.JLabel();
        titulo = new javax.swing.JLabel();
        artista1Gene = new javax.swing.JLabel();
        labelArtistas = new javax.swing.JLabel();
        artista1Nome = new javax.swing.JLabel();
        artista2Nome = new javax.swing.JLabel();
        artista2Gene = new javax.swing.JLabel();
        artista3Nome = new javax.swing.JLabel();
        artista3Gene = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        qtdTotalIngressos = new javax.swing.JLabel();
        inicio = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();
        fim = new javax.swing.JLabel();
        jLabel18 = new javax.swing.JLabel();
        tipoAcomodacao = new javax.swing.JLabel();
        jLabel20 = new javax.swing.JLabel();
        botaoVoltar = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        venderIngressoButton.setText("Vender Ingresso");
        venderIngressoButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                venderIngressoButtonActionPerformed(evt);
            }
        });

        cancelado.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        cancelado.setForeground(new java.awt.Color(255, 0, 0));
        cancelado.setText("Este evento está CANCELADO!");

        titulo.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
        titulo.setText("Detalhes do Evento");

        artista1Gene.setText("Artista1Genero");

        labelArtistas.setText("Artistas Participantes:");

        artista1Nome.setText("Artista1Nome");

        artista2Nome.setText("Artista2Nome");

        artista2Gene.setText("Artista2Genero");

        artista3Nome.setText("Artista3Nome");

        artista3Gene.setText("Artista3Genero");

        jLabel8.setText("Ingressos:");

        qtdTotalIngressos.setText("QtdIngressos");

        inicio.setText("inicio");

        jLabel16.setText("Início:");

        fim.setText("fim");

        jLabel18.setText("Fim:");

        tipoAcomodacao.setText("tipoAcomodacao");

        jLabel20.setText("Tipo de Acomodação:");

        botaoVoltar.setText("Voltar");
        botaoVoltar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botaoVoltarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(58, 58, 58)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(labelArtistas)
                    .addComponent(artista2Nome)
                    .addComponent(artista3Nome)
                    .addComponent(jLabel8)
                    .addComponent(artista1Nome))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(artista1Gene)
                            .addComponent(qtdTotalIngressos)
                            .addComponent(artista3Gene)
                            .addComponent(artista2Gene))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 75, Short.MAX_VALUE)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel18)
                            .addComponent(jLabel20))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(tipoAcomodacao)
                            .addComponent(fim))
                        .addGap(115, 115, 115))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(jLabel16)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(inicio)
                        .addGap(171, 171, 171))))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(venderIngressoButton, javax.swing.GroupLayout.PREFERRED_SIZE, 227, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(63, 63, 63))
            .addGroup(layout.createSequentialGroup()
                .addGap(22, 22, 22)
                .addComponent(botaoVoltar)
                .addContainerGap())
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(layout.createSequentialGroup()
                            .addGap(86, 86, 86)
                            .addComponent(titulo))
                        .addGroup(layout.createSequentialGroup()
                            .addGap(173, 173, 173)
                            .addComponent(cancelado)))
                    .addContainerGap(290, Short.MAX_VALUE)))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(75, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labelArtistas)
                    .addComponent(jLabel16)
                    .addComponent(inicio))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(artista1Gene)
                    .addComponent(artista1Nome)
                    .addComponent(jLabel18)
                    .addComponent(fim))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(artista2Nome)
                    .addComponent(artista2Gene)
                    .addComponent(tipoAcomodacao)
                    .addComponent(jLabel20))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(artista3Nome)
                    .addComponent(artista3Gene))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel8)
                    .addComponent(qtdTotalIngressos))
                .addGap(18, 18, 18)
                .addComponent(venderIngressoButton)
                .addGap(103, 103, 103)
                .addComponent(botaoVoltar)
                .addGap(49, 49, 49))
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(titulo)
                    .addGap(11, 11, 11)
                    .addComponent(cancelado)
                    .addContainerGap(332, Short.MAX_VALUE)))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void venderIngressoButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_venderIngressoButtonActionPerformed
// TODO add your handling code here:
        if (evento.getTipoAcomodacao().equals("Em Pé")) {
            LugaresEmPe tela = new LugaresEmPe(evento);
            tela.setVisible(true);
        } else {
            LugaresSentado tela = new LugaresSentado(evento);
            tela.setVisible(true);
        }
        this.setVisible(false);
    }//GEN-LAST:event_venderIngressoButtonActionPerformed

    private void botaoVoltarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botaoVoltarActionPerformed
        TelaBilheteria tb = new TelaBilheteria();
        tb.setVisible(true);
        this.setVisible(false);
    }//GEN-LAST:event_botaoVoltarActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new VerEventoBilheteria().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel artista1Gene;
    private javax.swing.JLabel artista1Nome;
    private javax.swing.JLabel artista2Gene;
    private javax.swing.JLabel artista2Nome;
    private javax.swing.JLabel artista3Gene;
    private javax.swing.JLabel artista3Nome;
    private javax.swing.JButton botaoVoltar;
    private javax.swing.JLabel cancelado;
    private javax.swing.JLabel fim;
    private javax.swing.JLabel inicio;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel labelArtistas;
    private javax.swing.JLabel qtdTotalIngressos;
    private javax.swing.JLabel tipoAcomodacao;
    private javax.swing.JLabel titulo;
    private javax.swing.JButton venderIngressoButton;
    // End of variables declaration//GEN-END:variables
}
